#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 110;
ll a[N], b[N], c[N],sum;
int main()
{
	ll n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
		sum += a[i] * b[i] * c[i];
	}
	if (sum % m != 0)
		cout << sum / m + 1 << " " << sum % m << endl;
	else
		cout << sum / m << " " << sum/(sum/m) << endl;
	return 0;
}